// 用户模块
export default {
  namespaced: true,
  state() {
    return {
      // 用户信息
      profile: {
        id: '',
        avatar: '',
        nickname: '',
        account: '',
        mobile: '',
        token: ''
      },
      redirectUrl: '/'
    }
  },
  mutations: {
    // 修改用户信息，payload就是用户信息对象
    setUser(state, payload) {
      state.profile.id = payload.id
      state.profile.account = payload.account
      state.profile.nickname = payload.nickname
      state.profile.avatar = payload.avatar
      state.profile.token = payload.token
      state.profile.mobile = payload.mobile
    },
    setRedirectUrl(state, url) {
      state.redirectUrl = url
    }
  }
}